package com.yaojiaxun.logisticsPlatformSystem.util;

import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;

/**
 * @Auther: yjx_j
 * @Date: 2019/1/2 22:27
 * @Description: 时间转换
 */
public class TimeFormat {
    public static String convertTime(long time){
        DateTimeFormatter dtf= DateTimeFormatter.ofPattern("yyyy-MM-dd");
        return dtf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()));
    }
    public static String convertTime2(long time){
        DateTimeFormatter dtf= DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
        return dtf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()));
    }
    public static String convertTime3(long time){
        DateTimeFormatter dtf= DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm");
        return dtf.format(LocalDateTime.ofInstant(Instant.ofEpochMilli(time), ZoneId.systemDefault()));
    }
}
